package com.ruoyi.web.TemuStore.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.TemuStore.domain.TemuStore;
import com.ruoyi.web.TemuStore.service.ITemuStoreService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * TemuStoreController
 * 
 * @author kzc
 * @date 2025-07-27
 */
@RestController
@RequestMapping("/TemuStore/TemuStore")
public class TemuStoreController extends BaseController
{
    @Autowired
    private ITemuStoreService temuStoreService;

    /**
     * 查询TemuStore列表
     */
    @PreAuthorize("@ss.hasPermi('TemuStore:TemuStore:list')")
    @GetMapping("/list")
    public TableDataInfo list(TemuStore temuStore)
    {
        startPage();
        List<TemuStore> list = temuStoreService.selectTemuStoreList(temuStore);
        return getDataTable(list);
    }

    /**
     * 导出TemuStore列表
     */
    @PreAuthorize("@ss.hasPermi('TemuStore:TemuStore:export')")
    @Log(title = "TemuStore", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TemuStore temuStore)
    {
        List<TemuStore> list = temuStoreService.selectTemuStoreList(temuStore);
        ExcelUtil<TemuStore> util = new ExcelUtil<TemuStore>(TemuStore.class);
        util.exportExcel(response, list, "TemuStore数据");
    }

    /**
     * 获取TemuStore详细信息
     */
    @PreAuthorize("@ss.hasPermi('TemuStore:TemuStore:query')")
    @GetMapping(value = "/{storeId}")
    public AjaxResult getInfo(@PathVariable("storeId") String storeId)
    {
        return success(temuStoreService.selectTemuStoreByStoreId(storeId));
    }

    /**
     * 新增TemuStore
     */
    @PreAuthorize("@ss.hasPermi('TemuStore:TemuStore:add')")
    @Log(title = "TemuStore", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TemuStore temuStore)
    {
        return toAjax(temuStoreService.insertTemuStore(temuStore));
    }

    /**
     * 修改TemuStore
     */
    @PreAuthorize("@ss.hasPermi('TemuStore:TemuStore:edit')")
    @Log(title = "TemuStore", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TemuStore temuStore)
    {
        return toAjax(temuStoreService.updateTemuStore(temuStore));
    }

    /**
     * 删除TemuStore
     */
    @PreAuthorize("@ss.hasPermi('TemuStore:TemuStore:remove')")
    @Log(title = "TemuStore", businessType = BusinessType.DELETE)
	@DeleteMapping("/{storeIds}")
    public AjaxResult remove(@PathVariable String[] storeIds)
    {
        return toAjax(temuStoreService.deleteTemuStoreByStoreIds(storeIds));
    }
}
